<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div id="app">
    {{msg}}
    <br />

    <!-- 其他开发者 看到 会很迷惑 -->
    {{ msg.split('').reverse().join('') }}
    <br />

    <!-- 有缓存效果 -->
    {{ reversemsg }}
    {{ reversemsg }}
    {{ reversemsg }}
    {{ reversemsg }}
    {{ reversemsg }}
    <br />
    {{ reverseFn() }}
    {{ reverseFn() }}
    {{ reverseFn() }}
    {{ reverseFn() }}
    {{ reverseFn() }}
  </div>
  <script src="./vue.js"></script>
  <script>
    new Vue({
      el: '#app',
      data: {
        msg: 'hello Vue'
      },
      methods: {
        reverseFn() {
          console.log('methods')
          return this.msg.split('').reverse().join('')
        }
      },
      computed: {
        reversemsg() {
          console.log('computed')
          return this.msg.split('').reverse().join('')
        }
      }
    })
  </script>
</body>
</html>